<?php
$name = 'Paypal';
$folder = 'paypal';

function getData($id, $case) {
  global $name, $folder;
  
  require_once dirname(__FILE__) . '/../../../DbUtils.class.php';
  require_once dirname(__FILE__) . '/../../../includes/MiscUtils.class.php';
  $myPdo = DbUtils::createPdoInst();
  
  $result = new stdClass();
  $result->folder = $folder;
  $result->width = 1000;
  $result->height = 300;
  
  $result->payment = new stdClass();
  $result->payment->is_formal = 0;
  $result->payment->account = '';
  $result->payment->currency_code = '';
  $result->payment->return_link = '';
  $result->payment->cancel_link = '';
  
  $result->codes = array('USD', 'CNY', 'NZD', 'AUD');
  
  $cond_vals = new stdClass();
  $cond_vals->c = 't.id = :v1';
  $cond_vals->v = array(':v1' => $id);
  $tmp = DbUtils::get($myPdo, 'pz_ecom_mthd_payment', $cond_vals, NULL, NULL, NULL, NULL, NULL)->d[0];
  $result->width = isset($tmp->width) ? $tmp->width : $result->width;
  $result->height = isset($tmp->height) ? $tmp->height : $result->height;
  
  $cond_vals = new stdClass();
  $cond_vals->c = 't.payment_id = :v1';
  $cond_vals->v = array(':v1' => $id);
  $payments = DbUtils::get($myPdo, TABLE_NAME_PREFIX_PAYMENT . $folder . '_payment', $cond_vals, NULL, NULL, NULL, NULL, NULL)->d;
  if (count($payments) > 0) {
    $result->payment = $payments[0];
  }
  
  if ($case == 0) {
    $result->menus = MiscUtils::createMenuInst(DbUtils::get(DbUtils::createPdoInst(), 'pz_menu', NULL, 't.order', 'ASC', NULL, NULL, NULL)->d, NULL);
  }
  return $result;
}
?>